/*
 * Block.cpp
 *
 *  Created on: 4 apr 2010
 *      Author: Andreas
 */

#include "Block.h"
#include "engine/graphics/Sprite.h"
#include <iostream>
using namespace std;

namespace Single {

Block::Block(int x, int y) : Sprite("Sprites/block.png"){
	moveTo(x, y);
	active = true;
	radius = 8;
	cout << "Single::Block created" << endl;
}

Block::~Block() {

}

void Block::draw() {
	if (active) {
		Sprite::draw();
	}
}

void Block::update(int elapsed) {
	respawnTimer -= elapsed;
	if (respawnTimer <= 0) {
		respawnTimer = 0;
		active = true;
	}
}

void Block::setActive(bool b) {
	active = b;
	if (!active) {
		respawnTimer = 5000;
	}
}

}
